import {request} from '@/utils/request.js'
import {appConfig} from '@/config/config.js'

// 查询失物招领列表
export function getLostFoundList(params) {
	params.orderByColumn = 'create_time'
	params.isAsc = 'desc'
	return request.get(appConfig.WEB_API + '/lost/list', params)
}

// 查询我的失物招领列表
export function getMyLostFoundList(params) {
	return request.get(appConfig.WEB_API + '/lost/myList', params)
}

// 查询失物招领详细信息
export function getLostFoundInfo(foundId) {
	return request.get(appConfig.WEB_API + '/lost/' + foundId)
}

// 获取商品所属用户
export function getUserInfo(foundId) {
	return request.get(appConfig.WEB_API + '/lost/user/' + foundId)
}

// 发布失物招领
export function publish(params) {
	return request.post(appConfig.WEB_API + '/lost/publish', params)
}

// 删除帖子
export function deleteByFoundId(foundId) {
	return request.delete(appConfig.WEB_API + '/lost/delete/' + foundId)
}

// 招领
export function claim(foundId) {
	return request.put(appConfig.WEB_API + '/lost/claim/' + foundId)
}

// 归还
export function returnFound(foundId) {
	return request.put(appConfig.WEB_API + '/lost/return/' + foundId)
}

// 查询我的认领
export function getMyClaimList(params) {
	return request.get(appConfig.WEB_API + '/lost/myClaim', params)
}

// 查询我的归还
export function getMyReturnList(params) {
	return request.get(appConfig.WEB_API + '/lost/myReturn', params)
}